<!-- @format -->

<template>
	<div :v-loading="true" class="ma-content-block p-4" style="height:calc(100vh - 110px)">
	  <!-- <a-tabs @change="handletab">
		<a-tab-pane key="1">
		  <template #title> <icon-calendar /> 整车 </template> -->
		  <div class="flex flex_column" style="height:100%">
			<div class="lg:flex">
			  <a-tooltip content="请选择公司">
				<a-select style="width:calc((100% - 80px) / 6);margin-right:16px;margin-bottom:16px" :filter-option="filterOption" v-model="formObj.dept_id" :options="dept_list" :field-names="{value: 'id', label: 'name'}"  allow-clear allow-search
							placeholder="请选择公司" @change="hadnleChangeDept" />
			  </a-tooltip>
			  <a-tooltip content="请选择合同">
				<a-select style="width:calc((100% - 80px) / 6);margin-right:16px;margin-bottom:16px" v-model="formObj.contract_id" :options="contract_list" :field-names="{value: 'id', label: 'name'}"  allow-clear allow-search
							placeholder="请选择合同" @change="hadnleChangeContract" />
			  </a-tooltip>
			  <a-tooltip content="请选择品名">
				<a-select style="width:calc((100% - 80px) / 6);margin-right:16px;margin-bottom:16px" :filter-option="filterOption" v-model="formObj.goods_id" :options="goods_list" :field-names="{value: 'id', label: 'name'}"  allow-clear allow-search
							placeholder="请选择品名" />
			  </a-tooltip>
			  <a-tooltip content="请输入箱号">
				<a-input v-model="formObj.box" placeholder="请输入箱号" allow-clear style="width:calc((100% - 80px) / 6);margin-right:16px;margin-bottom:16px" />
			  </a-tooltip>
			  <a-tooltip content="请输入箱型箱类">
				<a-input v-model="formObj.box_type" placeholder="请输入箱型箱类" allow-clear style="width:calc((100% - 80px) / 6);margin-right:16px;margin-bottom:16px" />
			  </a-tooltip>
			  <a-tooltip content="请输入车号">
				<a-input v-model="formObj.car_no" placeholder="请输入车号" allow-clear style="width:calc((100% - 80px) / 6);margin-bottom:16px" />
			  </a-tooltip>
			</div>
			<div class="lg:flex">
			  
			  <a-tooltip content="请选择装卸任务">
				<a-select style="width:calc((100% - 80px) / 6);margin-right:16px;margin-bottom:16px" v-model="formObj.load" :options="load_list" :field-names="{value: 'id', label: 'name'}"  allow-clear allow-search
							placeholder="请选择装卸任务" />
			  </a-tooltip>
			  <a-tooltip content="请选择到站类型">
				<a-select style="width:calc((100% - 80px) / 6);margin-right:16px;margin-bottom:16px" v-model="formObj.is_car" :options="is_carList" :field-names="{value: 'id', label: 'name'}"  allow-clear allow-search
							placeholder="请选择到站类型" />
			  </a-tooltip>
			  <a-tooltip content="请选择是否仓储">
				<a-select style="width:calc((100% - 80px) / 6);margin-right:16px;margin-bottom:16px" v-model="formObj.serve_type" :options="fuwuList" :field-names="{value: 'key', label: 'title'}"  allow-clear allow-search
							placeholder="请选择是否仓储" />
			  </a-tooltip>
			  <a-tooltip content="请选择运输方式">
				<a-select style="width:calc((100% - 80px) / 6);margin-bottom:16px;margin-right:16px;" v-model="formObj.transport_type" :options="yunshuList" :field-names="{value: 'key', label: 'title'}"  allow-clear allow-search
							placeholder="请选择运输方式" />
			  </a-tooltip>
			  <a-tooltip content="请选择到达时间">
				<a-range-picker
				  style="width:calc((100% - 80px) / 6);margin-right:16px;margin-bottom:16px"
				  show-time
				  :time-picker-props="{ defaultValue: ['00:00:00', '23:59:59'] }"
				  format="YYYY-MM-DD HH:mm"
				  @ok="handleOkTime"
				/>
			  </a-tooltip>
			  <a-tooltip content="请选择创建时间">
				<a-range-picker
				  style="width:calc((100% - 80px) / 6);margin-bottom:16px"
				  show-time
				  :time-picker-props="{ defaultValue: ['00:00:00', '23:59:59'] }"
				  format="YYYY-MM-DD HH:mm"
				  @ok="handleOkTimes"
				/>
			  </a-tooltip>
			</div>
			<div class="lg:flex">
			  <div class="flex ">
				<a-button type="primary" style="margin-right:16px;" @click="handleSouSuo">搜索</a-button>
				<a-button @click="handleChongZhi">重置</a-button>
			  </div>
			</div>
			<div class="flex marbot16">
			  <a-button type="primary" style="margin-right:16px;" @click="handelShowUp" v-auth="['prediction:manage:importBat']">批量预报</a-button>
			  <a-button type="primary" style="margin-right:16px;" @click="handleChongGouAdd">新增预报</a-button>
			  <!-- <a-button style="margin-right:16px;" @click="handelStation" v-auth="['prediction:station:index']">到站确认</a-button> -->
			  <a-button style="margin-right:16px;" @click="setFdcc(tab)" v-auth="['prediction:order:blth']">仓储入库</a-button>
			  <a-button style="margin-right:16px;" @click="handleExpord">导出</a-button>
			</div>
			<!-- 表格数据 -->
			<!-- 表头 -->
			<div class="flex" style="background:rgba(248, 248, 248, 1);border:1px solid rgba(231, 231, 231, 1)">
			  <div style="width:70px;padding:12px" class="flex  align_center">
				<div>序号</div>
			  </div>
			  <div class="flex_1 flex  align_center" style="padding:12px;word-wrap: break-word;" v-for="(item,index) in columnChongGou" :key="index">
				<div>{{item.name}}</div>
			  </div>
			</div>
			<!-- 表身 -->
			<div class="flex_1 biaoshen" style="overflow:auto;margin-bottom:12px">
			  <div class="tableCentant" v-for="(ite,ind) in chongGouList" :key="ind">
				<div class="flex justify_between bule font14 align_center" style="padding:16px;background:rgba(238, 244, 255, 1)">
				  <div class="flex heis">
					<div class="marr16">操作人：{{ite.create_user.nickname}}</div>
                  	<div class="">创建时间：{{ite.created_at}}</div>
				  </div>
				  <div class="flex align_center">
					<div class="" @click="handleRuyuan(ite)" v-if='ite.load == 3' v-auth="['prediction:manage:fbzx']"><a-link>发布装卸任务</a-link></div>
					<div v-if='ite.load == 3' style="height:24px;width:1px;background:rgba(0, 0, 0, 0.25);margin:0 16px"></div>
					<div class="" @click="handleXiugaiweight(ite)"><a-link>修改计费重量</a-link></div>
					<div style="height:24px;width:1px;background:rgba(0, 0, 0, 0.25);margin:0 16px"></div>
					<div class="" v-if="ite.prediciont_status < 5 && ite.prediciont_status != 1 && ite.prediction_pay_status == 0" @click="handleEdit(ite)" ><a-link>编辑</a-link></div>
					<div v-if="ite.prediciont_status < 5 && ite.prediciont_status != 1 && ite.prediction_pay_status == 0" style="height:24px;width:1px;background:rgba(0, 0, 0, 0.25);margin:0 16px"></div>
					<div class="" @click="handleZhangdan(ite)"><a-link>账单</a-link></div>
					<div style="height:24px;width:1px;background:rgba(0, 0, 0, 0.25);margin:0 16px"></div>
					<a-popconfirm
					  content="是否删除此条信息?"
					  v-if="ite.prediciont_status == 0"
					  @ok="handleDel(ite)"
					>
					  <div class=""><a-link>删除</a-link></div>
					</a-popconfirm>
				  </div>
				</div>
				<div class="flex " style="padding:12px 0">
				  <div style="width:70px;padding:12px" class="flex  align_center">
					<div>{{formObj.page == 1? ind + 1 : ((formObj.page - 1) * 10) + (ind + 1) }}</div>
				  </div>
				  <div class="flex_1 flex justify_center flex_column" style="padding:12px;word-wrap: break-word;" v-for="(item,index) in columnChongGou" :key="index">
					<div v-if="item.index == 'car_no'">{{ite.car_no}}</div>
					<div v-if="item.index == 'contract_id'">
					  <div>{{ite.dept.name}}</div>
					  <div>{{ite.contract_no}}</div>
					</div>
					<div v-if="item.index == 'goods_id'">
					  <div>{{ite.goods_name}}</div>
					</div>
					<div v-if="item.index == 'box'">
					  <div>{{ite.box}}</div>
					  <div>{{ite.box_type}}</div>
					  <div>{{ite.box_belong}}</div>
					</div>
					<div v-if="item.index == 'number_yu'">
					  <div>{{ite.number_yu}}件/{{ite.yb_weight}}吨</div>
					</div>
					<div v-if="item.index == 'number'">
					  <div>{{ite.number}}件/{{ite.weight}}吨</div>
					</div>
					<div v-if="item.index == 'weight_yu'">
					  <div>{{ite.weight_yu}}吨</div>
					</div>
					<div v-if="item.index == 'check_status'">
					  <div>{{ite.check_status == 0?'未巡查':ite.check_status == 1?'正常':ite.check_status == 2?'异常':""}}</div>
					</div>
					<div v-if="item.index == 'prediction_pay_status'">
					  <div>{{ite.check_status == 0?'待支付':ite.check_status == 1?'已支付':""}}</div>
					</div>
					<div v-if="item.index == 'come_time'">
					  <div>{{ite.come_time}}</div>
					</div>
				  </div>
				</div>
			  </div>
			</div>
			<div class="flex justify_end">
			  <a-pagination :total="chongGouTotal" show-total show-jumper show-page-size @change="handleChongGouPage" @page-size-change="handleChongGouSizePage" />
			</div>
			
		  </div>
		  <!-- 按钮 -->
		  <!-- <a-space size="medium" :fill="true">
			<a-button
			  v-for="(item, index) in prediciont_statusList.value"
			  :key="index"
			  :type="item.key == prediciont_status ? 'primary' : 'secondary'"
			  @click="handleprediciont_status(item.key, 1)"
			  >{{ item.title }}</a-button
			>
		  </a-space>
		  <div style="margin-bottom: 20px"></div> -->
		  <!-- CRUD 组件 -->
  
  
		  <!-- <ma-crud
			@selection-change="setSelectedKeys"
			:options="options"
			:columns="columns"
			ref="crudRef"
		  >
			<template #dept_id="{ record }">
			  <a-tag :color="record.remark?'red':'blue'" >{{ record?.dept?.name }}
				<a-tooltip :content="record.remark" position="tl">
				  <icon-exclamation-circle-fill v-if="record.remark" :size="16" />
				</a-tooltip>
			  </a-tag>
			  </template>
			  <template #contract_id="{ record }">
				<a-tooltip :content='record.contract_no'>
				  <div>{{ record.contract_no }}</div>
				</a-tooltip>
				
			  </template>
			  <template #goods_id="{ record }">
				<a-tooltip :content='record.goods_name'>
				  <div>{{ record.goods_name }}</div>
				</a-tooltip>
				
			  </template>
			  <template #check_status="{ record }">
				<a-tag
				  :color="
					record.check_status == 0
					  ? 'gray'
					  : record.check_status == 1
					  ? 'green'
					  : 'red'
				  "
				  >{{
					record.check_status == 0
					  ? "未巡查"
					  : record.check_status == 1
					  ? "正常"
					  : "异常"
				  }}</a-tag
				>
			  </template>
			  <template #warehouse_id="{ record }">
				<div >
				  {{
					record.warehouse_link != null
					  ? record?.warehouse_link?.warehouse?.name +
						record?.warehouse_link.horizontal_position +
						"-" +
						record.warehouse_link.release_position +
						"-" +
						record.warehouse_link.reaches_position
					  : ""
				  }}
				</div>
			  </template>
			  <template #load="{ record }">
				<a-tag  color="orangered"  v-if='record.load == 3'>无</a-tag>
				<a-tag  color="green"  v-if='record.load == 1'>已完成</a-tag>
				<a-tag  color="red"  v-if='record.load == 2'>未完成</a-tag>
			  </template>
			  <template #tableBeforeButtons>
				<a-button
				  @click="setFdsl(tab)"
				  type="outline"
				  v-auth="['prediction:order:blth']"
				  >办理提货</a-button
				>
				<a-button
				  @click="setFdcc(tab)"
				  type="outline"
				  v-auth="['warehouse:order:save']"
				  >仓储入库</a-button
				>
				<a-button
				  type="outline"
				  @click="handelStation"
				  v-auth="['prediction:station:index']"
				  ><icon-upload /> 到站数据</a-button
				>
				<a-button
				  type="primary"
				  @click="handelShowUp"
				  v-auth="['prediction:manage:importBat']"
				  ><icon-upload /> 预报批量</a-button
				>
			  </template>
			  <template #operationBeforeExtend="{ record }">
				<a-button shape="round" size="mini" type="primary" @click="handleRuyuan(record)" v-if='record.load == 3' v-auth="['prediction:manage:fbzx']">发布装卸</a-button>
				<a-button type="primary" size="mini" shape="round" @click="handleLogIndex(record)" :disabled='record.prediciont_status > 0 && record.check_status > 0?false:true' v-auth="['prediction:log:xcjl']" >巡查记录</a-button>
				<a-button type="primary" size="mini" shape="round" @click="handleEdit(record)" :disabled='record.prediciont_status < 5 && record.prediciont_status != 1 && record.prediction_pay_status == 0 ?false:true' >编辑</a-button>
				<a-button type="primary" size="mini" shape="round" @click="handleXiugaiweight(record)" >修改计费重量</a-button>
				<a-button shape="round" size="mini" type="primary" @click="handleZhangdan(record)" >账单</a-button>
				<a-popconfirm
				  content="是否删除此条信息?"
				  v-if="record.prediciont_status == 0"
				  @ok="handleDel(record)"
				>
				  <a-button type="primary" size="mini" shape="round" >删除</a-button>
				</a-popconfirm>
			  </template>
  
			  <template #summaryCell="{ column, record, rowIndex }">
				{{
				  column.dataIndex == "dept_id"
					? "合计"
					: column.dataIndex == "weight" ||
					  column.dataIndex == "weight_yu" ||
					  column.dataIndex == "yb_weight"
					? (record[column.dataIndex] - 0).toFixed(3)
					: record[column.dataIndex]
				}}
			</template>
		  </ma-crud> -->
		<!-- </a-tab-pane> -->
  
		<!-- <a-tab-pane key="2">
		  <template #title> <icon-clock-circle /> 集装箱 </template>
		  <a-space size="medium" :fill="true">
			<a-button
			  v-for="(item, index) in prediciont_statusList.value"
			  :key="index"
			  :type="item.key == prediciont_status ? 'primary' : 'secondary'"
			  @click="handleprediciont_status(item.key, 2)"
			  >{{ item.title }}</a-button
			>
		  </a-space>
		  <div style="margin-bottom: 20px"></div>
		  <ma-crud
			@selection-change="setSelected"
			:options="optionsJzx"
			:columns="columnsJZX"
			ref="crudRefJzx"
		  >
			<template #dept_id="{ record }">
			  <a-tag :color="record.remark?'red':'blue'" >{{ record?.dept?.name }}
				  <a-tooltip :content="record.remark" position="tl">
					  <icon-exclamation-circle-fill v-if="record.remark" :size="16" />
				  </a-tooltip>
			  </a-tag>
			</template>
			
			<template #box_type_id="{ record }">
			  <div>{{ record.box_type }}</div>
			</template>
			<template #contract_id="{ record }">
			  <a-tooltip :content='record.contract_no'>
				<div>{{ record.contract_no }}</div>
			  </a-tooltip>
			  
			</template>
			<template #goods_id="{ record }">
			  <a-tooltip :content='record.goods_name'>
				<div>{{ record.goods_name }}</div>
			  </a-tooltip>
			  
			</template>
			
			<template #warehouse_id="{ record }">
			  <div>
				{{
				  record.warehouse_link != null
					? record?.warehouse_link?.warehouse?.name +
					  record?.warehouse_link.horizontal_position +
					  "-" +
					  record.warehouse_link.release_position +
					  "-" +
					  record.warehouse_link.reaches_position
					: ""
				}}
			  </div>
			</template>
			<template #load="{ record }">
			  <a-tag  color="orangered" bordered v-if='record.load == 3'>无</a-tag>
			  <a-tag  color="green" bordered v-if='record.load == 1'>已完成</a-tag>
			  <a-tag  color="red" bordered v-if='record.load == 2'>未完成</a-tag>
			</template>
			<template #tableBeforeButtons>
			  <a-button
				@click="setFdsl(tab)"
				type="outline"
				v-auth="['prediction:order:blth']"
				>办理提货</a-button
			  >
			  <a-button
				@click="setFdcc(tab)"
				type="outline"
				v-auth="['warehouse:order:save']"
				>仓储入库</a-button
			  >
			  <a-button
				type="outline"
				@click="handelStation"
				v-auth="['prediction:station:index']"
				><icon-upload /> 到站数据</a-button
			  >
			  <a-button
				type="primary"
				@click="handelShowUp"
				v-auth="['prediction:manage:importBat']"
				><icon-upload /> 预报批量</a-button
			  >
			</template>
			<template #operationBeforeExtend="{ record }">
			  <a-button shape="round" size="mini" type="primary" @click="handleRuyuan(record)" v-if='record.load == 3' v-auth="['prediction:manage:fbzx']">发布装卸</a-button>
			  <a-button type="primary" size="mini" shape="round" @click="handleLogIndex(record)" :disabled='record.prediciont_status > 0 && record.check_status > 0?false:true' v-auth="['prediction:log:xcjl']" >巡查记录</a-button>
			  <a-button type="primary" size="mini" shape="round" @click="handleEdit(record)" :disabled='record.prediciont_status < 5 && record.prediciont_status != 1 && record.prediction_pay_status == 0 ?false:true'>编辑</a-button>
			  <a-button type="primary" size="mini" shape="round" @click="handleXiugaiweight(record)" >修改计费重量</a-button>
			  <a-button shape="round" size="mini" type="primary" @click="handleZhangdan(record)" >账单</a-button>
			  <a-popconfirm
				content="是否删除此条信息?"
				v-if="record.prediciont_status == 0"
				@ok="handleDel(record)"
			  >
				<a-button type="primary" size="mini" shape="round" >删除</a-button>
			  </a-popconfirm>
			</template>
			<template #summaryCell="{ column, record, rowIndex }">
			  {{
				column.dataIndex == "dept_id"
				  ? "合计"
				  : column.dataIndex == "weight" ||
					column.dataIndex == "weight_yu" ||
					column.dataIndex == "yb_weight"
				  ? (record[column.dataIndex] - 0).toFixed(3)
				  : record[column.dataIndex]
			  }}
			</template>
		  </ma-crud>
		</a-tab-pane>
	  </a-tabs> -->
  
	  <!-- 入园 -->
	  <!-- 编辑弹窗 -->
	  <a-modal :mask-closable="false" 
		v-model:visible="ruyuanShow"
		title="装卸任务"
		@cancel="handleruyuanShow"
		:width="1000"
		@ok="handleTJyuyuan"
		v-if="ruyuanShow"
	  >
		<a-form :model="rowData">
		  <a-row :gutter="16">
			<a-col :span="24">
			  <a-form-item
				field="work_line"
				label="作业线路"
				label-col-flex="80px"
			  >
				<a-input
				  v-model="rowData.work_line"
				  placeholder="请输入作业线路"
				/>
			  </a-form-item>
			</a-col>
		  </a-row>
		  <a-row :gutter="16">
			<a-col :span="24">
			  <a-form-item
				field="transport_number"
				label="车厢位置"
				label-col-flex="80px"
			  >
				<a-input
				  v-model="rowData.transport_number"
				  placeholder="请输入车厢位置"
				/>
			  </a-form-item>
			</a-col>
		  </a-row>
		</a-form>
	  </a-modal>
  
	  <!-- 编辑弹窗 -->
	  <a-modal :mask-closable="false" 
		v-model:visible="editShow"
		title="编辑"
		@cancel="handleeditShow"
		:width="1000"
		@ok="handleTJedit"
		v-if="editShow"
	  >
		<a-form :model="rowData">
		  <a-row :gutter="16">
			<a-col :span="8">
			  <a-form-item field="name" label="公司名称" label-col-flex="80px">
				<a-input
				  v-model="rowData.dept.name"
				  disabled
				  placeholder="请输入公司名称"
				/>
			  </a-form-item>
			</a-col>
			<a-col :span="8">
			  <a-form-item
				field="contract_no"
				label="合同号"
				label-col-flex="80px"
			  >
				<a-input
				  v-model="rowData.contract_no"
				  disabled
				  placeholder="请输入合同号"
				/>
			  </a-form-item>
			</a-col>
			<a-col :span="8">
			  <a-form-item
				field="goods_name"
				label="品名"
				label-col-flex="80px"
			  >
				<a-input
				  v-model="rowData.goods_name"
				  disabled
				  placeholder="请输入品名"
				/>
			  </a-form-item>
			</a-col>
		  </a-row>
		  <a-row :gutter="16">
			<a-col :span="8">
			  <a-form-item
				field="transport_type"
				label="运输方式"
				label-col-flex="80px"
			  >
				
				<a-select
				  v-model="rowData.transport_type"
				  placeholder="请选择"
				  allow-clear
				>
				  <a-option
					:value="items.key"
					v-for="(items, indexs) in yunshuList.value"
					:key="indexs"
					>{{ items.title }}</a-option
				  >
				</a-select>
			  </a-form-item>
			</a-col>
			<a-col :span="8">
			  <a-form-item
				field="serve_type"
				label="是否仓储"
				label-col-flex="80px"
			  >
				<!-- <a-input v-model="rowData.serve_type"  placeholder="请输入材料号" /> -->
				<a-select
				  v-model="rowData.serve_type"
				  placeholder="请选择"
				  allow-clear
				>
				  <a-option
					:value="items.key"
					v-for="(items, indexs) in fuwuList.value"
					:key="indexs"
					>{{ items.title }}</a-option
				  >
				</a-select>
			  </a-form-item>
			</a-col>
			<a-col :span="8">
			  <a-form-item field="car_no" label="车号" label-col-flex="80px">
				<a-input v-model="rowData.car_no" placeholder="请输入车号" />
			  </a-form-item>
			</a-col>
		  </a-row>
		  <a-row :gutter="16">
			<a-col :span="24">
			  <a-form-item field="producer" label="发站" label-col-flex="80px">
				<a-input v-model="rowData.producer" placeholder="请输入发站" />
			  </a-form-item>
			</a-col>
			<a-col :span="8">
			  <a-form-item
				field="number"
				label="数量（件）"
				label-col-flex="80px"
			  >
				<a-input v-model="rowData.number_yu" placeholder="请输入数量" />
			  </a-form-item>
			</a-col>
			<a-col :span="8">
			  <a-form-item
				field="weight"
				label="重量（吨）"
				label-col-flex="80px"
			  >
				<a-input v-model="rowData.yb_weight" placeholder="请输入重量" />
			  </a-form-item>
			</a-col>
			
		  </a-row>
		  <a-row :gutter="16" v-if="tab == 2">
			
			
			<a-col :span="8" >
			  <a-form-item
				field="box_type_id"
				label="箱型箱类"
				label-col-flex="80px"
			  >
				<a-select
				  v-model="rowData.box_type_id"
				  placeholder="请选择"
				  allow-clear
				>
				  <a-option
					:value="items.id"
					v-for="(items, indexs) in boxTypeList.value"
					:key="indexs"
					>{{ items.name }}</a-option
				  >
				</a-select>
			  </a-form-item>
			</a-col>
			<a-col :span="8" >
			  <a-form-item field="box" label="箱号" label-col-flex="80px">
				<a-input v-model="rowData.box" placeholder="请输入箱号" />
			  </a-form-item>
			</a-col>
			<a-col :span="8">
			  <a-form-item
				field="box_belong"
				label="箱属"
				label-col-flex="80px"
			  >
				<a-input v-model="rowData.box_belong" placeholder="请输入箱属" />
			  </a-form-item>
			</a-col>
		  </a-row>
		  
		  
		</a-form>
	  </a-modal>
  
	  <!-- 新增弹窗 -->
	  <a-modal :mask-closable="false" 
		v-model:visible="addShow"
		title="新增"
		@cancel="addShow = false"
		:width="1000"
		@ok="handleAdd"
		v-if="addShow"
	  >
		  <div class="lg:flex">
			  <a-tooltip content="请选择公司">
				<a-select style="width:calc((100% - 48px) / 4);margin-right:16px;margin-bottom:16px" :filter-option="filterOption" v-model="addObj.dept_id" :options="dept_list" :field-names="{value: 'id', label: 'name'}"  allow-clear allow-search
							placeholder="请选择公司" @change="hadnleChangeDept" />
			  </a-tooltip>
			  <a-tooltip content="请选择合同">
				<a-select style="width:calc((100% - 48px) / 4);margin-right:16px;margin-bottom:16px" v-model="addObj.contract_id" :options="contract_list" :field-names="{value: 'id', label: 'name'}"  allow-clear allow-search
							placeholder="请选择合同" @change="hadnleChangeContract" />
			  </a-tooltip>
			  <a-tooltip content="请选择品名">
				<a-select style="width:calc((100% - 48px) / 4);margin-right:16px;margin-bottom:16px" :filter-option="filterOption" v-model="addObj.goods_id" :options="goods_list" :field-names="{value: 'id', label: 'name'}"  allow-clear allow-search
							placeholder="请选择品名" />
			  </a-tooltip>
			  <a-tooltip content="请输入车号">
			  <a-input v-model="addObj.car_no" placeholder="请输入车号" allow-clear style="width:calc((100% - 48px) / 4);margin-bottom:16px" />
			</a-tooltip>
			  
		  </div>
		  <div class="flex">
			<a-tooltip content="请输入箱号">
			  <a-input v-model="addObj.box" placeholder="请输入箱号" allow-clear style="width:calc((100% - 48px) / 4);margin-right:16px;margin-bottom:16px" />
			</a-tooltip>
			<a-tooltip content="请输入箱属">
			  <a-input v-model="addObj.box_belong" placeholder="请输入箱属" allow-clear style="width:calc((100% - 48px) / 4);margin-right:16px;margin-bottom:16px" />
			</a-tooltip>
			<a-tooltip content="请选择是否仓储">
			  <a-select style="width:calc((100% - 48px) / 4);margin-right:16px;margin-bottom:16px" v-model="addObj.serve_type" :options="fuwuList" :field-names="{value: 'key', label: 'title'}"  allow-clear allow-search
						  placeholder="请选择是否仓储" />
			</a-tooltip>
			<a-tooltip content="请选择运输方式">
			  <a-select style="width:calc((100% - 48px) / 4);margin-bottom:16px" v-model="addObj.transport_type" :options="yunshuList" :field-names="{value: 'key', label: 'title'}"  allow-clear allow-search
						  placeholder="请选择运输方式" />
			</a-tooltip>
		  </div>
		  <div class="flex" v-if="addObj.transport_type == 1">
			<a-tooltip content="请选择箱型箱类">
			  <a-select style="width:calc((100% - 48px) / 4);margin-right:16px;margin-bottom:16px" v-model="addObj.box_type_id" :options="boxTypeList" :field-names="{value: 'id', label: 'name'}"  allow-clear allow-search
						  placeholder="请选择箱型箱类" />
			</a-tooltip>
			<a-tooltip content="请选择集装箱">
			  <a-select style="width:calc((100% - 48px) / 4);margin-bottom:16px;margin-right:16px;" v-model="addObj.is_empty" :options="is_emptyList" :field-names="{value: 'id', label: 'name'}"  allow-clear allow-search
						  placeholder="请选择集装箱" />
			</a-tooltip>
			<a-tooltip content="请输入预报件数">
			  <a-input v-model="addObj.number_yu" placeholder="请输入预报件数" allow-clear style="width:calc((100% - 48px) / 4);margin-right:16px;margin-bottom:16px" />
			</a-tooltip>
			<a-tooltip content="请输入预报重量">
			  <a-input v-model="addObj.yb_weight" placeholder="请输入预报重量" allow-clear style="width:calc((100% - 48px) / 4);margin-bottom:16px" />
			</a-tooltip>
		  </div>
		  <div class="flex" >
			
			<a-tooltip content="请输入发站">
			  <a-input v-model="addObj.producer" placeholder="请输入发站" allow-clear style="width:calc((100% - 48px) / 4);margin-right:16px;margin-bottom:16px" />
			</a-tooltip>
		  </div>
	  </a-modal>
  
	  <!-- 修改计费重量 -->
	  <a-modal :mask-closable="false" 
		v-model:visible="xiugaiweightShow"
		title="修改计费重量"
		@cancel="handlexiugaiweightShow"
		:width="1000"
		@ok="handleTJXGedit"
		v-if="xiugaiweightShow"
	  >
		<a-form :model="xiugaiweightItem">
		  <a-form-item field="name" label="公司名称" label-col-flex="80px">
			  <a-input
			  v-model="xiugaiweightItem.dept.name"
			  disabled
			  placeholder="请输入公司名称"
			  />
		  </a-form-item>
		  <a-form-item field="batch_no" label="原始凭证号" label-col-flex="80px">
			  <a-input
			  v-model="xiugaiweightItem.batch_no"
			  disabled
			  placeholder="请输入原始凭证号"
			  />
		  </a-form-item>
		  <a-form-item field="car_no" label="车号" label-col-flex="80px">
			  <a-input
			  v-model="xiugaiweightItem.car_no"
			  disabled
			  placeholder="请输入车号"
			  />
		  </a-form-item>
		  <a-form-item field="weight_yu" label="计费重量" label-col-flex="80px">
			  <a-input
			  v-model="xiugaiweightItem.weight_yu"
			  placeholder="请输入计费重量"
			  />
		  </a-form-item>
		</a-form>
	  </a-modal>
  
	  <!-- 导入 -->
	  <a-modal :mask-closable="false" 
		v-model:visible="showUpload"
		title="导入Excel"
		@cancel="handleShow"
		:width="1000"
		:footer="false"
	  >
		<div style="display: flex; flex-wrap: wrap">
		  <div
			style="
			  display: flex;
			  padding: 8px 10px;
			  dispaly: flex;
			  align-items: center;
			  width: calc(100% / 3);
			"
		  >
			<div style="width: 100px">运输方式：</div>
			<a-select v-model="yunshuId" placeholder="请选择运输方式">
			  <a-option
				v-for="(item, index) in yunshuList.value"
				:key="index"
				:value="item.key"
				:label="item.title"
			  />
			</a-select>
		  </div>
		  <div
			style="
			  display: flex;
			  padding: 8px 10px;
			  dispaly: flex;
			  align-items: center;
			  width: calc(100% / 3);
			"
		  >
			<div style="width: 100px">是否仓储：</div>
			<a-select v-model="fuwuId" placeholder="请选择是否仓储">
			  <a-option
				v-for="(item, index) in fuwuList.value"
				:key="index"
				:value="item.key"
				:label="item.title"
			  />
			</a-select>
		  </div>
		  <!-- <div style="display:flex;padding:8px 10px;dispaly:flex;align-items: center;width:calc(100% / 3)">
			<div style="width:100px">是否对装：</div>
			<a-select v-model="duijieId" placeholder="请选择是否对装">
			  <a-option v-for="(item, index) in duijieList.value" :key="index" :value="item.key" :label="item.title" />
			</a-select>
		  </div> -->
		  <div
			style="
			  display: flex;
			  padding: 8px 10px;
			  dispaly: flex;
			  align-items: center;
			  width: calc(100% / 3);
			"
		  >
			<div style="width: 100px">企业名称：</div>
			<a-select
			  v-model="yonghuId"
			  placeholder="请选择企业名称"
			  :filter-option="filterOption"
			  allow-search
			>
			  <a-option
				v-for="(item, index) in yonghuList.value"
				:key="index"
				:value="item.id"
				:label="item.name"
			  />
			</a-select>
		  </div>
		</div>
		<div
		  style="padding: 8px 10px; display: flex; align-items: flex-end"
		  v-if="showUpload"
		>
		  <a-upload
			:file-list="fileList"
			draggable
			:action="
			  env.VITE_APP_OPEN_PROXY === 'true'
				? env.VITE_APP_PROXY_PREFIX + '/prediction/manage/importBat'
				: env.VITE_APP_BASE_URL + '/prediction/manage/importBat'
			"
			:headers="{ Authorization: `Bearer ${token}` }"
			:on-before-upload="beforeUpload"
			:limit="1"
			:data="{
			  transport_type: yunshuId,
			  serve_type: fuwuId,
			  butt_type: duijieId,
			  dept_id: yonghuId,
			}"
			@success="handleSuccess"
		  />
		  <div style="margin-left: 12px; color: #1e80ff">
			<a-popconfirm content="是否下载模版?" @ok="downFromOther">
			  <a>模板下载</a>
			</a-popconfirm>
		  </div>
		</div>
	  </a-modal>
  
	  <!-- 预览预计导入的数据 -->
	  <a-modal :mask-closable="false" 
		v-model:visible="showYuji"
		title="确认导入数据"
		@cancel="handleYujiCel"
		:width="1400"
		ok-text="确认导入"
		:footer="false"
	  >
		<a-table
		  summary-text="合计"
		  summary
		  :columns="columnsEpor"
		  row-key="id"
		  v-model:selectedKeys="selectedKeys"
		  :bordered="{ wrapper: true, cell: true }"
		  :row-selection="{
			type: 'checkbox',
			showCheckedAll: true,
			onlyCurrent: false,
		  }"
		  :data="yujiList"
		  @selection-change="handleSelChange"
		  :pagination="false"
		>
		  <template #remark="{ record, rowIndex }">
			<a-tooltip :content="record.remark">
			  <div
				style="
				  color: red;
				  overflow: hidden;
				  text-overflow: ellipsis;
				  white-space: nowrap;
				"
			  >
				{{ record.remark }}
			  </div>
			</a-tooltip>
		  </template>
		  <template #is_empty="{ record, rowIndex }">
			<div>{{record.is_empty == 1?'空箱':'重箱'}}</div>
		  </template>
		  <template #summary-cell="{ column, record, rowIndex }">
			{{
			  column.dataIndex == "batch_no"
				? "合计"
				: column.dataIndex == "yb_weight"
				? (record[column.dataIndex] - 0).toFixed(3) + "吨"
				: column.dataIndex == "number"
				? record[column.dataIndex] + "件"
				: record[column.dataIndex]
			}}
		  </template>
		</a-table>
		<div style="display: flex; justify-content: flex-end; margin-top: 2%">
		  <a-button type="primary" @click="handleYujiSucc">确认导入</a-button>
		</div>
	  </a-modal>
  
	  <!-- 到站导入 -->
	  <a-drawer
		:footer="false"
		:width="1400"
		v-model:visible="visiblestation"
		@cancel="handlestationCancel"
	  >
		<template #title> 到站导入 </template>
		<station ref="stationRef" @upLoadSuccess="handleStartEnd" />
	  </a-drawer>
	  <a-modal :mask-closable="false" 
		v-model:visible="visiblecangcuSL"
		title="仓储入库"
		@cancel="visiblecangcuSL = false"
		:width="1400"
		ok-text="确认导入"
		:footer="false"
	  >
	  
		<div style="height:calc(100vh - 200px);overflow:auto">
		  <cangcuSL ref="cangcuSLRef"  />
		</div>
		
	  </a-modal>
	  <!-- 仓储受理 -->
	  <!-- <a-drawer :footer="false" :width="1440" v-model:visible="visiblecangcuSL">
		<template #title> 仓储受理 </template>
		<cangcuSL ref="cangcuSLRef" />
	  </a-drawer> -->
	  <!-- 巡查记录 -->
	  <a-drawer :footer="false" :width="1400" v-model:visible="visibleLog">
		<template #title> 巡查记录 </template>
		<logIndex ref="logRef" />
	  </a-drawer>
	  <!-- 账单 -->
	  <a-drawer
		  v-model:visible="orderShowItems"
		  :footer="false"
		  :width="1400"
		  v-if='orderShowItems'
	  >
		<template #title> 账单</template>
		<OrderShowItems  ref="orderShowItemsRef" :info='orderShowItem'/>
	  </a-drawer>
	</div>
  </template>
  <script setup>
  import { ref, reactive, onMounted } from "vue";
  import predictionManage from "@/api/prediction/predictionManage";
  import predictionAddress from "@/api/prediction/predictionAddress";
  import warehouseOrder from "@/api/warehouse/warehouseOrder";
  import { pinyin } from "pinyin-pro"
  import predictionOrder from "@/api/prediction/predictionOrder";
  import predictionOrderDetail from "@/api/prediction/predictionOrderDetail";
  import predictionLog from "@/api/prediction/predictionLog";
  import station from "@/views/prediction/station/index.vue";
  import guoguiSL from "@/views/prediction/manage/guoguiSL.vue";
  import cangcuSL from "@/views/prediction/manage/cangcuSL.vue";
  import logIndex from "@/views/prediction/log/index.vue";
  import OrderShowItems from "../order/orderShowItems.vue"
  import commonApi from "@/api/common";
  import { Message } from "@arco-design/web-vue";
  import { Notification } from "@arco-design/web-vue";
  
  import { request } from "@/utils/request.js";
  import tool from "@/utils/tool";
  import * as common from "@/utils/common";
  import { useUserStore } from "@/store";
  import { success, info, error } from "@/utils/common";
  const userStore = useUserStore();
  const user = userStore.user;
  const env = ref(import.meta.env);
  const token = ref(tool.local.get(import.meta.env.VITE_APP_TOKEN_PREFIX));
  const crudRef = ref();
  const crudRefJzx = ref();
  const fileList = reactive([]);
  const pick_method = ref();
  const drivers = reactive([]);
  const drivers_id = ref();
  const visiblestation = ref(false);
  const visibleguoguiSL = ref(false);
  const visiblecangcuSL = ref(false);
  const visibleLog = ref(false);
  const orderShowItems = ref(false)
  const orderShowItemsRef = ref();
  const orderShowItem = ref()
  const logRef = ref();
  const stationRef = ref();
  const guoguiSLRef = ref();
  const cangcuSLRef = ref();
  
  const prediciont_status = ref("");
  const prediciont_statusList = reactive([]);
  
  // 1=先打后提,2=先提后打
  const methodArr = reactive([
	{ id: 1, name: "先打后提" },
	{ id: 2, name: "先提后打" },
  ]);
  const driver_id = ref();
  const showYuji = ref(false);
  let tab = '';
  let ids = [];
  let keys = [];
  let datas = [];
  let pick_type = [];
  let buff_type = [];
  let addresslist = [];
  let yujiList = [];
  const selectedKeys = ref([]);
  const pick_typeid = ref();
  const address_id = ref();
  const buff_typeid = ref();
  const xiugaiweightShow = ref(false);
  const xiugaiweightItem = ref({});
  let ccArr = [];
  const loadings = ref(true);
  const ccid = ref(0);
  const nums = ref(0);
  const hengArr = ref([]);
  const zongArr = ref([]);
  const cengArr = ref([]);
  const editShow = ref(false);
  const ruyuanShow = ref(false);
  let rowData = {};
  const addShow = ref(false)
  const addobj = reactive({
	lat: "",
	lng: "",
	delivery_mobile: "",
	delivery_address: "",
	delivery_tel: "",
	delivery_unit: "",
  });
  const formObj = ref({
	page:1,
	pageSize:10,
	dept_id:'',  // 公司
	contract_id:'',  // 合同号
	goods_ids:'',    //品名
	load:'',    // 装卸任务
	car_no:'',    // 车号
	box:'',    // 集装箱
	box_type:'',   // 集装类型
	is_car:'',    // 到站类型
	serve_type:'',   // 是否仓储
	transport_type:'',   // 运输方式
	come_time:'',   // 到达时间
	created_at:'',   // 创建时间
  })
  const columnChongGou = ref([
	{
	  index:'dept_id',
	  name:'车号'
	},
	{
	  index:'contract_id',
	  name:'合同'
	},
	{
	  index:'goods_id',
	  name:'品名'
	},
	{
	  index:'box',
	  name:'集装箱'
	},
	{
	  index:'transport_type',
	  name:'运输方式'
	},
	{
	  index:'number_yu',
	  name:'预报件数/重量'
	},
	{
	  index:'number',
	  name:'剩余件数/重量'
	},
	{
	  index:'weight_yu',
	  name:'计费重量'
	},
	{
	  
	  index:'check_status',
	  name:'巡查状态'
	},
	{
	  index:'prediction_pay_status',
	  name:'支付状态'
	},
	{
	  index:'pay_price',
	  name:'账单金额'
	},
	{
	  index:'come_time',
	  name:'到达时间'
	},
  ])
  const chongGouList = ref([])
  const chongGouTotal = ref()
  const next = ref(1)
  const dept_list = ref([])   //  公司列表
  const contract_list = ref([])  // 合同列表
  const goods_list = ref([])  // 合同列表
  const load_list = ref([
	{ name: "无", id: 3 },
	{ name: "未完成", id: 2 },
	{ name: "已完成", id: 1 },
  ])
  const is_carList= ref([
	{ name: "火车", id: 0 },
	{ name: "汽车", id: 1 },
  ])
  const is_emptyList= ref([
	{ name: "空箱", id: 1 },
	{ name: "重箱", id: 2 },
  ])
  const addObj = ref({
	box:'',
	box_belong:'',
	box_type_id:'',
	car_no:'',
	contract_id:'',
	dept_id:'',
	goods_id:'',
	number_yu:'',
	producer:'',
	serve_type:'',
	transport_type:'',
	yb_weight:'',
	box:'',
	is_empty:'',
  })
  const handleSouSuo = () =>{   //搜索
	formObj.value.page = 1
	handleChongGouList()
  }
  const handleChongZhi = () =>{   //重置
	formObj.value.page = 1
	formObj.value.pageSize = 10
	formObj.value.dept_id = ''
	formObj.value.contract_id = ''
	formObj.value.goods_ids = ''
	formObj.value.load = ''
	formObj.value.car_no = ''
	formObj.value.box = ''
	formObj.value.box_type = ''
	formObj.value.is_car = ''
	formObj.value.serve_type = ''
	formObj.value.transport_type = ''
	formObj.value.come_time = ''
	formObj.value.created_at = ''
	handleChongGouList()
  }
  const handleNext = (e)=>{
	next.value = e
  }
  const handleExpord = ()=>{   // 导出
	Message.info('请求服务器下载文件中...')
	const data = {page:1,pageSize:10}
	const download = (url) => request({ url, data, method: 'post', timeout: 60 * 1000, responseType: 'blob' })
  
	download('prediction/manage/export').then(res => {
	  tool.download(res)
	  Message.success('请求成功，文件开始下载')
	}).catch(() => {
	  Message.error('请求服务器错误，下载失败')
	})
  }
  const filterOption = (v,option)=>{
	return option.keywords.some(keywords=>keywords.includes(v))
}
  const handleChongGouAdd = ()=>{
	addObj.value = {
	  box:'',
	  box_belong:'',
	  box_type_id:'',
	  car_no:'',
	  contract_id:'',
	  dept_id:'',
	  goods_id:'',
	  number_yu:'',
	  producer:'',
	  serve_type:'',
	  transport_type:'',
	  yb_weight:'',
	  box:'',
	  is_empty:'',
	}
	addShow.value = true
  }
  const handleAdd = ()=>{
	let obj = {}
	for(let key in addObj.value){
	  if(addObj.value[key]){
		obj[key] = addObj.value[key]
	  }
	}
	predictionManage.save(obj).then(res=>{
	  if(res.code == 200){
		Message.success('新增成功！')
		addShow.value = false
		formObj.value.page = 1
		handleChongGouList()
	  }
	})
  }
  
  const handleChongGouPage = (page)=>{
	formObj.value.page = page
	handleChongGouList()
  }
  const handleChongGouSizePage = (pageSize)=>{
	formObj.value.pageSize = pageSize
	if(formObj.value.page == 1){
	  handleChongGouList()
	}else{
  
	}
  }
  const handleOkTime = (dateString, date)=>{
	formObj.value.come_time = dateString
  }
  const handleOkTimes = (dateString, date)=>{
	formObj.value.created_at = dateString
  }
  const handleDeptList = ()=>{   //  获取公司列表
	request({
		url: 'system/dept/remote',
		method: 'post',
		data:{
		  openPage:false,
		  remoteOption:{
			filter:{
			  type:['=',2],
			  status: ['=',1]
			},
			select: ["id", "name"],
			sort: {id: "desc"}
		  }
		}
	  }).then(res=>{
		res.data.map((v,i)=>{
				v.keywords = [
				v.name,
				pinyin(v.name,{toneType:'none',pattern:'first'}).split(' ').join(''),
				pinyin(v.name,{toneType:'none',pattern:'first'}).split(' ').join('').toUpperCase()
				]
		})
		dept_list.value = res.data
	  })
  }
  
  const hadnleChangeDept = (e)=>{
	contract_list.value = []
	addObj.value.contract_id = ''
	formObj.value.contract_id = ''
	addObj.value.goods_id = ''
	formObj.value.goods_id = ''
	handleContract(e)
  }
  
  const handleContract = (id)=>{
	request({
		url: 'system/userContract/remote_prediction?dept_id=' + id,
		method: 'get',
		params:{
		  openPage:false,
		}
	  }).then(res=>{
		contract_list.value = res.data
	  })
  }
  const hadnleChangeContract = (e)=>{
	goods_list.value = []
	addObj.value.goods_id = ''
	formObj.value.goods_id = ''
	request({
		url: 'system/userContractGoods/remote_prediction?contract_id=' + e,
		method: 'get',
		params:{
		  openPage:false,
		}
	  }).then(res=>{
		res.data.map((v,i)=>{
				v.keywords = [
				v.name,
				pinyin(v.name,{toneType:'none',pattern:'first'}).split(' ').join(''),
				pinyin(v.name,{toneType:'none',pattern:'first'}).split(' ').join('').toUpperCase()
				]
		})
		goods_list.value = res.data
	  })
  }
  
  
  const handleZhangdan = (item)=>{
	orderShowItems.value = true
	orderShowItem.value = item
  }
  const handleXiugaiweight = (item) => {
	xiugaiweightShow.value = true;
	xiugaiweightItem.value = item;
  };
  const handlexiugaiweightShow = () => {
	  xiugaiweightShow.value = false;
  };
  const handlecolse = (e) => {
	next.value = 1
	visibleguoguiSL.value = false;
  };
  const handlestationCancel = () => {
	// crudRef.value.refresh();
	// crudRefJzx.value.refresh();
	formObj.value.page = 1
	handleChongGouList()
  };
  
  const handelStation = (currentRow) => {
	stationRef.value.open(currentRow);
	visiblestation.value = true;
  };
  
  const handleprediciont_status = (key, index) => {
	if (index == 1) {
	  prediciont_status.value = key;
	  crudRef.value.requestParams.prediciont_status = key;
	  crudRef.value.requestData();
	} else {
	  prediciont_status.value = key;
	  crudRefJzx.value.requestParams.prediciont_status = key;
	  crudRefJzx.value.requestData();
	}
  };
  
  const handelys = (e) => {};
  
  const downFromOther = () => {
	let download = new XMLHttpRequest();
	download.open("GET", "https://aiagent-api.sntyjt.com/drmb.xlsx", true);
	download.responseType = "blob";
	download.onload = function (e) {
	  var url = window.URL.createObjectURL(download.response);
	  var a = document.createElement("a");
	  a.href = url;
	  a.download = "批量预报导入模版.xlsx";
	  document.body.appendChild(a);
	  a.click();
	  document.body.removeChild(a);
	};
	download.send();
  };
  
  const handelShowUp = () => {
	showUpload.value = true;
	yunshuId.value = "";
	fuwuId.value = "";
	// duijieId.value = "";
	yonghuId.value = "";
	fileList.value = [];
	selectedKeys.value = [];
  };
  
  // 巡查记录
  const handleLogIndex = (row) => {
	visibleLog.value = true;
	logRef.value.open(row);
  };
  
  // 删除
  const handleDel = (row) => {
	predictionManage.deletes({ ids: [row.id] }).then((res) => {
	  Notification.success(res.message);
	  crudRef.value.refresh();
	  crudRefJzx.value.refresh();
	});
  };
  
  const handleeditShow = async () => {
	editShow.value = false;
  };
  // 提交编辑
  const handleTJedit = () => {
	predictionManage.update(rowData.id, rowData).then((res) => {
	  Notification.success(res.message);
	  crudRef.value.refresh();
	  crudRefJzx.value.refresh();
	  editShow.value = false;
	});
  };
  // 提交修改计费重量
  const handleTJXGedit = () =>{
	  let object = JSON.parse(JSON.stringify(xiugaiweightItem.value))
	  object.weight = object.weight_yu
	  predictionManage.update(xiugaiweightItem.value.id, object).then((res) => {
	  Notification.success(res.message);
	  crudRef.value.refresh();
	  crudRefJzx.value.refresh();
	  xiugaiweightShow.value = false;
	});
  }
  
  const handleEdit = (row) => {
	rowData = row;
	rowData.transport_type = rowData.transport_type + "";
	rowData.serve_type = rowData.serve_type + "";
	editShow.value = true;
  };
  
  const handleTJyuyuan = () => {
	predictionManage.zhuangxieUpdata(rowData.id, rowData).then((res) => {
	  Notification.success(res.message);
	  crudRef.value.refresh();
	  crudRefJzx.value.refresh();
	  ruyuanShow.value = false;
	});
  };
  
  const handleruyuanShow = () => {
	ruyuanShow.value = false;
  };
  
  const handleRuyuan = (row) => {
	rowData = row;
	ruyuanShow.value = true;
  };
  
  // 导入之前处理
  const beforeUpload = () => {
	if (!yunshuId.value || !fuwuId.value || !yonghuId.value) {
	  Message.error("信息不能为空！");
	  return false;
	} else {
	  return true;
	}
  };
  
  // 预报单导入成功
  const handleSuccess = (res) => {
	showUpload.value = false;
	showYuji.value = true;
	let _data = res.response.data;
	let arr = [];
	_data.map((v, i) => {
	  v.id = i + 1;
	  if (v.import_status == 0) {
		v.disabled = true;
	  } else {
		v.disabled = false;
		arr.push(v.id);
	  }
	  v.yb_weight = v.yb_weight - 0;
	  v.number = v.number - 0;
	});
	selectedKeys.value = arr;
	yujiList = _data;
	// crudRef.value.requestData();
	// crudRefJzx.value.requestData();
  };
  // 选择的
  const handleSelChange = (res) => {
  };
  
  const handleYujiCel = () => {
	next.value = 1
	showYuji.value = false;
  };
  
  // 成功   导入
  const handleYujiSucc = (res) => {
	if (selectedKeys.value.length == 0) {
	  Message.error("请选择导入的数据");
	  return true;
	}
	let arr = [];
	yujiList.map((v, i) => {
	  selectedKeys.value.map((vv, ii) => {
		if (vv == v.id) {
		  arr.push(v);
		}
	  });
	});
	predictionManage.importSave(arr).then((res) => {
	  if (res.code == 200) {
		showYuji.value = false;
		crudRef.value.requestData();
		crudRefJzx.value.requestData();
		return Notification.success("导入成功！");
	  }
	});
  };
  
  // 退出到站导入  更新列表
  const handleStartEnd = () => {
	// crudRef.value.requestData();
	// crudRefJzx.value.requestData();
	handleChongGouList()
  };
  
  const setSelected = (val) => {
	ids = val;
  };
  const setSelectedKeys = (val) => {
	keys = val;
  };
  let okloading = false;
  const visible = ref(false);
  const fdslvisible = ref(false);
  const ccvisible = ref(false);
  const showUpload = ref(false);
  const addressChange = async (row) => {
	let aa = await predictionAddress.getAddressInfo({ id: row });
	addobj.delivery_mobile = aa.data.mobile;
	addobj.delivery_address = aa.data.address;
	addobj.delivery_tel = aa.data.tel;
	addobj.delivery_unit = aa.data.unit;
	addobj.lat = aa.data.lat;
	addobj.lng = aa.data.lng;
  };
  
  const form = reactive({
	value: "",
  });
  
  const boxTypeList = reactive([]);
  const yunshuList = reactive([]);
  const yunshuId = ref();
  const fuwuList = reactive([]);
  const fuwuId = ref();
  const duijieList = reactive([]);
  // const duijieId = ref();
  const yonghuList = reactive([]);
  const yonghuId = ref();
  
  onMounted(() => {
	commonApi.getDict("transport_type").then((res) => {
	  yunshuList.value = res.data;
	});
	commonApi.getDict("serve_type").then((res) => {
	  fuwuList.value = res.data;
	});
	commonApi.getDict("butt_type").then((res) => {
	  duijieList.value = res.data;
	});
	commonApi.getDict("prediciont_status").then((res) => {
	  prediciont_statusList.value = [{ title: "全部", key: "" }, ...res.data];
	});
	handleyonghu();
	handleBoxtype();
	handleDeptList();
	handleChongGouList()
  });
  
  const handleChongGouList = ()=>{
	let obj = {}
	for(let key in formObj.value){
	  if(formObj.value[key]){
		obj[key] = formObj.value[key]
	  }
	}
	predictionManage.getList(obj).then(res=>{
	  console.log('formObj:',res.data)
	  chongGouList.value = res.data.items
	  chongGouTotal.value = res.data.pageInfo.total
	})
  }
  
  const handleBoxtype = ()=>{
	request({
	  url: "prediction/boxManage/index",
	  method: "get",
	  params: {
		openPage:false,
	  },
	}).then((res) => {
	  boxTypeList.value = res.data.items;
  
	});
  }
  
  const handleyonghu = () => {
	request({
	  url: "system/dept/remote",
	  method: "post",
	  data: {
		openPage: false,
		remoteOption: {
		  filter: { type: ["=", 2],status: ['=',1] },
		  relations: [],
		  select: ["id", "name"],
		  sort: { id: "desc" },
		},
	  },
	}).then((res) => {
		res.data.map((v,i)=>{
				v.keywords = [
				v.name,
				pinyin(v.name,{toneType:'none',pattern:'first'}).split(' ').join(''),
				pinyin(v.name,{toneType:'none',pattern:'first'}).split(' ').join('').toUpperCase()
				]
		})
	  yonghuList.value = res.data;
	});
  };
  
  const numberOperation = (newValue, id, numberName) => {
	predictionManage
	  .numberOperation({ id, numberName, numberValue: newValue })
	  .then((res) => {
		res.success && Message.success(res.message);
	  })
	  .catch((e) => {
		console.log(e);
	  });
  };
  
  const switchStatus = (statusValue, id, statusName) => {
	predictionManage
	  .changeStatus({ id, statusName, statusValue })
	  .then((res) => {
		res.success && Message.success(res.message);
	  })
	  .catch((e) => {});
  };
  // 分单受理
  const setFdsl = (row) => {
	visibleguoguiSL.value = true;
	setTimeout(() => {
	  guoguiSLRef.value.open(row);
	}, 200);
	
  };
  // 仓储受理
  const setFdcc = (row) => {
	visiblecangcuSL.value = true;
	cangcuSLRef.value.open(row);
  };
  
  const handletab = (index) => {
	tab = index;
  
	prediciont_status.value = "";
  };
  
  const handleShow = () => {
	showUpload.value = false;
  };
  
  const handleCancel = () => {
	visible.value = false;
  };
  const handleBeforeOk = (e) => {
	let keyArr = [];
	if (tab == 1) {
	  keyArr = keys;
	} else {
	  keyArr = ids;
	}
	predictionManage
	  .setPredictionById({ ids: keyArr, value: form.value })
	  .then((res) => {
		visible.value = false;
		okloading = false;
	  });
	crudRef.value.refresh();
	crudRefJzx.value.refresh();
  };
  const handlefdslCancel = () => {
	fdslvisible.value = false;
  };
  const handleccCancel = () => {
	ccvisible.value = false;
  };
  const handlefdslBeforeOk = async (e) => {
	let options = {
	  item: datas,
	  leixing: {
		butt: buff_typeid,
		pick: pick_typeid,
	  },
	  car_ids: drivers_id.value.join(","),
	  delivery_mobile: addobj.delivery_mobile,
	  delivery_address: addobj.delivery_address,
	  delivery_tel: addobj.delivery_tel,
	  delivery_unit: addobj.delivery_unit,
	  lat: addobj.lat,
	  lng: addobj.lng,
	};
	let cc = await predictionOrder.save(options);
	if (cc.success) {
	  crudRef.value.refresh();
	  crudRefJzx.value.refresh();
	  return Notification.success("分理成功！");
	} else {
	  return Notification.error("分理失败！");
	  crudRef.value.refresh();
	  crudRefJzx.value.refresh();
	}
	fdslvisible.value = false;
	okloading = false;
  };
  const handleccBeforeOk = async (e) => {
	let leixing = "";
	if (tab == 1) {
	  leixing = "2";
	} else {
	  leixing = "1";
	}
	ccArr.map((v, i) => {
	  v.horizontal_position = v.heng;
	  v.release_position = v.zong;
	  v.reaches_position = v.ceng;
	  v.warehouse_id = ccid.value;
	});
	let aa = await warehouseOrder.save({
	  item: datas,
	  leixing: leixing,
	  warehouse_id: ccid.value,
	});
	if (aa.code == 200) {
	  crudRef.value.refresh();
	  crudRefJzx.value.refresh();
	  success(aa.message);
	} else {
	  crudRef.value.refresh();
	  crudRefJzx.value.refresh();
	  error(aa.message);
	}
	fdslvisible.value = false;
	okloading = false;
  };
  
  const options = reactive({
	id: "flyos_prediction_manage",
  
	pk: "id",
	bordered: { cell: true },
	// bordered:true,
	operationColumn: true,
	operationWidth: 400,
	operationColumnWidth:300,
	showSummary: true,
	summary: [
	  {
		dataIndex: "number",
		action: "sum",
	  },
	  {
		dataIndex: "number_yu",
		action: "sum",
	  },
	  {
		dataIndex: "weight",
		action: "sum",
	  },
	  {
		dataIndex: "weight_yu",
		action: "sum",
	  },
	  {
		dataIndex: "yb_weight",
		action: "sum",
	  },
	],
	formOption: {
	  viewType: "modal",
	  width: 1000,
	  layout: [
		{
		  formType: "grid-tailwind",
		  customClass: ["mt-5"],
		  colNumber: 3,
		  bodyStyle: { paddingBottom: 0 },
		  cols: [
			{
			  formList: [{ dataIndex: "dept_id" }],
			},
			{
			  formList: [{ dataIndex: "contract_id" }],
			},
			{
			  formList: [{ dataIndex: "goods_id" }],
			},
		  ],
		},
  
		{
		  formType: "grid-tailwind",
		  customClass: [],
		  colNumber: 3,
		  bodyStyle: { paddingTop: 0 },
		  cols: [
			
			
			{
			  formList: [{ dataIndex: "transport_type" }],
			},
			{
			  formList: [{ dataIndex: "serve_type" }],
			},
			{
			  formList: [{ dataIndex: "car_no" }],
			},
			{
			  formList: [{ dataIndex: "number_yu" }],
			},
			{
			  formList: [{ dataIndex: "yb_weight" }],
			},
			// {
			//   formList: [{ dataIndex: "weight_yu" }],
			// },
			
		  ],
		},
	  ],
	},
	api: predictionManage.getList,
	recycleApi: predictionManage.getRecycleList,
	// 新增预报功能，使用的crud组件中的新增功能
	add: {
	  show: true,
	  api: predictionManage.save,
	  text: "新增预报",
	  auth: ["prediction:manage:save"],
	},
	edit: {
	  show: false,
	  api: predictionManage.update,
	  auth: ["prediction:manage:update"],
	},
	delete: {
	  show: false,
	  api: predictionManage.deletes,
	  auth: ["prediction:manage:delete"],
	  realApi: predictionManage.realDeletes,
	  realAuth: ["prediction:manage:realDeletes"],
	},
	recovery: {
	  show: true,
	  api: predictionManage.recoverys,
	  auth: ["prediction:manage:recovery"],
	},
	import: {
	  show: false,
	  url: "prediction/manage/import",
	  templateUrl: "prediction/manage/downloadTemplate",
	  auth: ["prediction:manage:import"],
	},
	export: {
	  show: true,
	  url: "prediction/manage/export",
	  auth: ["prediction:manage:export"],
	},
	beforeRequest: (params) => {
	  params.transport_type = 2;
	},
	beforeImport: () => {
	},
	afterRequest: (params) => {
	  params.map((v, i) => {
		if (v.prediciont_status == 5 || v.prediciont_status == 6) {
		  v.disabled = false;
		} else {
		  v.disabled = true;
		}
		if(v.load_detail == null){   // 未生成装卸任务
		  v.load = 3
		}else if(v.load_detail.detail_load_status == 0){ // 已生成装卸任务
		  v.load = 2
		}else if(v.load_detail.detail_load_status == 1){ // 已生成装卸任务
		  v.load = 1
		}
		v.weight = (v.weight - 0).toFixed(3);
		v.weight_yu = (v.weight_yu - 0).toFixed(3);
		v.yb_weight = (v.yb_weight - 0).toFixed(3);
		v.goods_ids = v.goods_id
	  });
	},
	beforeSearch:(params)=>{
	  console.log('搜索前：',params)
	  if(params.goods_ids){
		params.goods_id = params.goods_ids
	  }else{
		params.goods_id = ''
	  }
	}
  });
  
  const columns = reactive([
	{
	  title: "ID",
	  dataIndex: "id",
	  formType: "input",
	  addDisplay: false,
	  editDisplay: false,
	  hide: true,
	  commonRules: {
		required: true,
		message: "请输入ID",
	  },
	},
	{
	  title: "公司名称",
	  dataIndex: "dept_id",
	  align: "center",
	  formType: "select",
	  width: 200,
	  fixed: "left",
	  search: true,
	  dict: {
		// 远程通用接口请求，新版代码生成都有一个 remote 接口
		remote: "system/dept/remote",
		// 指定组件接收的props
		props: { label: "name", value: "id" },
		// 开启分页
		openPage: false,
		// 远程请求配置项
		remoteOption: {
		  // 按用户名排序
		  sort: { id: "desc" }, // 如果不指定排序方式，默认为正序排序
		  // 设置查询的字段
		  select: ["id", "name"],
		  // 设置数据过滤
		  filter: {
			type: ["=", 2],
			status: ['=',1]
		  },
		  // 关联模型
		  relations: [],
		},
	  },
	  cascaderItem: ["contract_id"],
	},
	{
	  title: "合同号",
	  dataIndex: "contract_id",
	  align: "center",
	  formType: "select",
	  fixed: "left",
	  search: true,
	  dict: {
		url: "system/userContract/remote_prediction?dept_id={{key}}",
		props: { label: "contract_no", value: "id" },
	  },
	  commonRules: {
		required: true,
		message: "请选择合同号",
	  },
	  cascaderItem: ["goods_id"],
	},
	
	{
	  title: "品名",
	  dataIndex: "goods_id",
	  formType: "select",
	  align: "center",
	  search: false,
	  addDisplay: true,
	  editDisplay: true,
	  dict: {
		url: "system/userContractGoods/remote_prediction?contract_id={{key}}",
		props: { label: "name", value: "goods_id" },
		cache: true,
	  },
	  commonRules: {
		required: true,
		message: "请选择品名",
	  },
	  control: (val, item) => {
		console.log(crudRef.value.crudFormRef);
	  },
	},
	{
	  title: "品名",
	  dataIndex: "goods_ids",
	  formType: "select",
	  align: "center",
	  search: true,
	  addDisplay: false,
	  editDisplay: false,
	  hide:true,
	  dict: {
		url: "goods/manage/index",
		params:{
		  page:1,
		  pageSize:500
		},
		props: { label: "name", value: "id" },
	  },
	  commonRules: {
		required: true,
		message: "请选择品名",
	  },
	},
	{
	  title: "装卸任务",
	  dataIndex: "load",
	  align: "center",
	  formType: "select",
	  width:100,
	  search: true,
	  addDisplay: false,
	  dict: {
		data() {
		  return [
			{ label: "无", value: 3 },
			{ label: "未完成", value: 2 },
			{ label: "已完成", value: 1 },
		  ];
		},
		translation: true,
		tagColors: {
		  1: "gray",
		  2: "red",
		  3: "green",
		},
	  },
	},
  
	{
	  title: "支付状态",
	  dataIndex: "prediction_pay_status",
	  formType: "select",
	  align: "center",
	  addDisplay: false,
	  search: false,
	  dict: {
		name: "prediction_pay_status",
		props: {
		  label: "title",
		  value: "key",
		},
		translation: true,
		tagColors: {
		  0: "red",
		  1: "green",
		},
	  },
	},
	{
	  title: "车号",
	  dataIndex: "car_no",
	  align: "center",
	  formType: "input",
	  search: true,
	},
	{
	  title: "到达时间",
	  dataIndex: "come_time",
	  formType: "range",
	  align: "center",
	  search: true,
	  width:180,
	  addDisplay: false,
	  editDisplay: false,
	  sortable: {
		sortDirections: ["ascend", "descend"],
		sorter: true,
	  },
	  showTime: true,
	},
	
	{
	  title: "到站类型",
	  dataIndex: "is_car",
	  formType: "select",
	  align: "center",
	  addDisplay: false,
	  search: true,
	  dict: {
		data() {
		  return [
			{ label: "火车", value: 0 },
			{ label: "汽车", value: 1 },
		  ];
		},
		translation: true,
	  },
	},
   
	{
	  title: "车厢位置",
	  dataIndex: "transport_number",
	  formType: "input",
	  align: "center",
	  addDisplay: false,
	  search: false,
	},
	{
	  title: "作业线路",
	  dataIndex: "work_line",
	  formType: "input",
	  align: "center",
	  addDisplay: false,
	  search: false,
	},
	{
	  title: "仓库位置",
	  dataIndex: "warehouse_id",
	  formType: "input",
	  align: "center",
	  search: false,
	  addDisplay: false,
	  editDisplay: false,
	},
	{
	  title: "预报件数",
	  dataIndex: "number_yu",
	  formType: "input",
	  align: "center",
	  width: 120,
	  // search: true
	},
	{
	  title: "剩余件数",
	  dataIndex: "number",
	  formType: "input",
	  align: "center",
	  addDisplay: false,
	  width: 120,
	  // search: true
	},
	{
	  title: "预报重量",
	  dataIndex: "yb_weight",
	  formType: "input",
	  align: "center",
	  width: 120,
	  // search: true
	},
  
	{
	  title: "剩余重量",
	  dataIndex: "weight",
	  align: "center",
	  formType: "input",
	  addDisplay: false,
	  width: 120,
	  //search: true
	},
	{
	  title: "计费重量",
	  dataIndex: "weight_yu",
	  align: "center",
	  formType: "input",
	  addDisplay:false,
	  width: 120,
	  //search: true
	},
   
	{
	  title: "原始凭证号",
	  dataIndex: "batch_no",
	  align: "center",
	  addDisplay: false,
	  editDisplay: false,
	  search: false
	},
  
	{
	  title: "原票号",
	  dataIndex: "ticket_number",
	  align: "center",
	  formType: "input",
	  addDisplay: false,
	  editDisplay: false,
	  commonRules: {
		// required: true,
		message: "请输入原票号",
	  },
	},
	{
	  title: "巡查状态",
	  dataIndex: "check_status",
	  formType: "select",
	  align: "center",
	  addDisplay: false,
	  editDisplay: false,
	  dict: {
		name: "check_status",
		props: {
		  label: "title",
		  value: "key",
		},
		translation: true,
	  },
	},
	{
	  title: "发站",
	  dataIndex: "producer",
	  align: "center",
	  formType: "input",
	  search: true,
	},
  
	{
	  title: "运输方式",
	  dataIndex: "transport_type",
	  formType: "select",
	  align: "center",
	  search: false,
	  dict: {
		name: "transport_type",
		props: {
		  label: "title",
		  value: "key",
		},
		translation: true,
	  },
	},
	{
	  title: "是否仓储",
	  dataIndex: "serve_type",
	  formType: "select",
	  align: "center",
	  search: true,
	  dict: {
		name: "serve_type",
		props: {
		  label: "title",
		  value: "key",
		},
		translation: true,
	  },
	},
	{
	  title: "是否对装",
	  dataIndex: "butt_type",
	  formType: "select",
	  align: "center",
	  search: false,
	  addDisplay: false,
	  editDisplay: false,
	  dict: {
		name: "butt_type",
		props: {
		  label: "title",
		  value: "key",
		},
		translation: true,
	  },
	},
  
	{
	  title: "状态",
	  dataIndex: "prediciont_status",
	  formType: "select",
	  align: "center",
	  search: false,
	  addDisplay: false,
	  editDisplay: false,
	  dict: {
		name: "prediciont_status",
		props: {
		  label: "title",
		  value: "key",
		},
		translation: true,
	  },
	},
	{
	  title: "操作人",
	  dataIndex: "create_user.nickname",
	  align: "center",
	  formType: "input",
	  addDisplay: false,
	  editDisplay: false,
	},
	{
	  title: "创建时间",
	  dataIndex: "created_at",
	  formType: "range",
	  align: "center",
	  search: true,
	  addDisplay: false,
	  editDisplay: false,
	  sortable: {
		sortDirections: ["ascend", "descend"],
		sorter: true,
	  },
	  showTime: true,
	},
	{
	  title: "更新时间",
	  dataIndex: "updated_at",
	  formType: "date",
	  addDisplay: false,
	  align: "center",
	  editDisplay: false,
	  hide: true,
	  showTime: true,
	},
	{
	  title: "删除时间",
	  dataIndex: "deleted_at",
	  formType: "date",
	  addDisplay: false,
	  align: "center",
	  editDisplay: false,
	  hide: true,
	  showTime: true,
	},
	{
	  title: "创建人",
	  dataIndex: "created_by",
	  align: "center",
	  formType: "input",
	  addDisplay: false,
	  editDisplay: false,
	  hide: true,
	},
	{
	  title: "修改人",
	  dataIndex: "updated_by",
	  align: "center",
	  formType: "input",
	  addDisplay: false,
	  editDisplay: false,
	  hide: true,
	},
  ]);
  
  const columnsJZX = reactive([
	{
	  title: "ID",
	  dataIndex: "id",
	  formType: "input",
	  addDisplay: false,
	  editDisplay: false,
	  hide: true,
	  commonRules: {
		required: true,
		message: "请输入ID",
	  },
	},
	{
	  title: "公司名称",
	  dataIndex: "dept_id",
	  align: "center",
	  formType: "select",
	  width: 200,
	  fixed: "left",
	  search: true,
	  dict: {
		// 远程通用接口请求，新版代码生成都有一个 remote 接口
		remote: "system/dept/remote",
		// 指定组件接收的props
		props: { label: "name", value: "id" },
		// 开启分页
		openPage: false,
		// 远程请求配置项
		remoteOption: {
		  // 按用户名排序
		  sort: { id: "desc" }, // 如果不指定排序方式，默认为正序排序
		  // 设置查询的字段
		  select: ["id", "name"],
		  // 设置数据过滤
		  filter: {
			type: ["=", 2],
			status: ['=',1]
		  },
		  // 关联模型
		  relations: [],
		},
	  },
	  cascaderItem: ["contract_id"],
	},
	{
	  title: "合同号",
	  dataIndex: "contract_id",
	  align: "center",
	  formType: "select",
	  fixed: "left",
	  search: true,
	  dict: {
		url: "system/userContract/remote_prediction?dept_id={{key}}",
		props: { label: "contract_no", value: "id" },
	  },
	  commonRules: {
		required: true,
		message: "请选择合同号",
	  },
	  cascaderItem: ["goods_id"],
	},
	{
	  title: "品名",
	  dataIndex: "goods_id",
	  formType: "select",
	  align: "center",
	  search: false,
	  addDisplay: true,
	  editDisplay: true,
	  dict: {
		url: "system/userContractGoods/remote_prediction?contract_id={{key}}",
		props: { label: "name", value: "goods_id" },
		cache: true,
	  },
	  commonRules: {
		required: true,
		message: "请选择品名",
	  },
	  control: (val, item) => {
		console.log(crudRef.value.crudFormRef);
	  },
	},
	{
	  title: "品名",
	  dataIndex: "goods_ids",
	  formType: "select",
	  align: "center",
	  search: true,
	  addDisplay: false,
	  editDisplay: false,
	  hide:true,
	  dict: {
		url: "goods/manage/index",
		props: { label: "name", value: "id" },
		params:{
		  page:1,
		  pageSize:500
		},
	  },
	  commonRules: {
		required: true,
		message: "请选择品名",
	  },
	},
	{
	  title: "车号",
	  dataIndex: "car_no",
	  align: "center",
	  formType: "input",
	  search: true,
	},
	{
	  title: "到达时间",
	  dataIndex: "come_time",
	  formType: "range",
	  align: "center",
	  width:180,
	  search: true,
	  addDisplay: false,
	  editDisplay: false,
	  sortable: {
		sortDirections: ["ascend", "descend"],
		sorter: true,
	  },
	  showTime: true,
	},
	
	{
	  title: "装卸任务",
	  dataIndex: "load",
	  align: "center",
	  formType: "select",
	  search: true,
	  addDisplay: false,
	  width:100,
	  dict: {
		data() {
		  return [
			{ label: "无", value: 3 },
			{ label: "未完成", value: 2 },
			{ label: "已完成", value: 1 },
		  ];
		},
		translation: true,
		tagColors: {
		  1: "gray",
		  2: "red",
		  3: "green",
		},
	  },
	},
	{
	  title: "支付状态",
	  dataIndex: "prediction_pay_status",
	  formType: "select",
	  align: "center",
	  addDisplay: false,
	  search: false,
	  dict: {
		name: "prediction_pay_status",
		props: {
		  label: "title",
		  value: "key",
		},
		translation: true,
		tagColors: {
		  0: "red",
		  1: "green",
		},
	  },
	},
	
	{
	  title: "箱号",
	  dataIndex: "box",
	  formType: "input",
	  align: "center",
	  search: true,
	  width:160,
	},
	{
	  title: "箱型箱类",
	  dataIndex: "box_type_id",
	  formType: "select",
	  align: "center",
	  width:160,
	  search: true,
	  dict: {
		  url: "prediction/boxManage/index",
		  props: { label: "name", value: "id" },
		  openPage: false,
	  },
	  commonRules: {
		  required: true,
		  message: "箱型箱类",
	  },
	 },
	{
	  title: "箱属",
	  dataIndex: "box_belong",
	  formType: "input",
	  align: "center",
	  search: true,
	},
	{
	  title: "车厢位置",
	  dataIndex: "transport_number",
	  formType: "input",
	  align: "center",
	  addDisplay: false,
	  search: false,
	},
	{
	  title: "作业线路",
	  dataIndex: "work_line",
	  formType: "input",
	  align: "center",
	  addDisplay: false,
	  search: false,
	},
	{
	  title: "仓库位置",
	  dataIndex: "warehouse_id",
	  formType: "input",
	  align: "center",
	  search: false,
	  addDisplay: false,
	  editDisplay: false,
	},
	{
	  title: "预报件数",
	  dataIndex: "number_yu",
	  formType: "input",
	  align: "center",
	  width: 120,
	  // search: true
	},
	{
	  title: "剩余件数",
	  dataIndex: "number",
	  formType: "input",
	  align: "center",
	  addDisplay: false,
	  width: 120,
	  // search: true
	},
	{
	  title: "预报重量",
	  dataIndex: "yb_weight",
	  formType: "input",
	  align: "center",
	  width: 120,
	  // search: true
	},
	{
	  title: "计费重量",
	  dataIndex: "weight_yu",
	  align: "center",
	  formType: "input",
	  addDisplay:false,
	  width: 120,
	  //search: true
	},
	{
	  title: "剩余重量",
	  dataIndex: "weight",
	  align: "center",
	  formType: "input",
	  addDisplay: false,
	  width: 120,
	  //search: true
	},
  
	{
	  title: "原始凭证号",
	  dataIndex: "batch_no",
	  align: "center",
	  addDisplay: false,
	  editDisplay: false,
	  search: false
	},
  
	{
	  title: "原票号",
	  dataIndex: "ticket_number",
	  align: "center",
	  formType: "input",
	  addDisplay: false,
	  editDisplay: false,
	  commonRules: {
		// required: true,
		message: "请输入原票号",
	  },
	},
	{
	  title: "巡查状态",
	  dataIndex: "check_status",
	  formType: "select",
	  align: "center",
	  addDisplay: false,
	  editDisplay: false,
	  dict: {
		name: "check_status",
		props: {
		  label: "title",
		  value: "key",
		},
		translation: true,
	  },
	},
	{
	  title: "发站",
	  dataIndex: "producer",
	  align: "center",
	  formType: "input",
	  search: true,
	},
  
	{
	  title: "运输方式",
	  dataIndex: "transport_type",
	  formType: "select",
	  align: "center",
	  search: false,
	  dict: {
		name: "transport_type",
		props: {
		  label: "title",
		  value: "key",
		},
		translation: true,
	  },
	},
	{
	  title: "是否仓储",
	  dataIndex: "serve_type",
	  formType: "select",
	  align: "center",
	  search: true,
	  dict: {
		name: "serve_type",
		props: {
		  label: "title",
		  value: "key",
		},
		translation: true,
	  },
	},
	{
	  title: "是否对装",
	  dataIndex: "butt_type",
	  formType: "select",
	  align: "center",
	  search: false,
	  addDisplay: false,
	  editDisplay: false,
	  dict: {
		name: "butt_type",
		props: {
		  label: "title",
		  value: "key",
		},
		translation: true,
	  },
	},
  
	{
	  title: "状态",
	  dataIndex: "prediciont_status",
	  formType: "select",
	  align: "center",
	  search: false,
	  addDisplay: false,
	  editDisplay: false,
	  dict: {
		name: "prediciont_status",
		props: {
		  label: "title",
		  value: "key",
		},
		translation: true,
	  },
	},
	{
	  title: "操作人",
	  dataIndex: "create_user.nickname",
	  align: "center",
	  formType: "input",
	  addDisplay: false,
	  editDisplay: false,
	},
	{
	  title: "创建时间",
	  dataIndex: "created_at",
	  formType: "range",
	  align: "center",
	  search: true,
	  addDisplay: false,
	  editDisplay: false,
	  sortable: {
		sortDirections: ["ascend", "descend"],
		sorter: true,
	  },
	  showTime: true,
	},
	{
	  title: "更新时间",
	  dataIndex: "updated_at",
	  formType: "date",
	  addDisplay: false,
	  align: "center",
	  editDisplay: false,
	  hide: true,
	  showTime: true,
	},
	{
	  title: "删除时间",
	  dataIndex: "deleted_at",
	  formType: "date",
	  addDisplay: false,
	  align: "center",
	  editDisplay: false,
	  hide: true,
	  showTime: true,
	},
	{
	  title: "创建人",
	  dataIndex: "created_by",
	  align: "center",
	  formType: "input",
	  addDisplay: false,
	  editDisplay: false,
	  hide: true,
	},
	{
	  title: "修改人",
	  dataIndex: "updated_by",
	  align: "center",
	  formType: "input",
	  addDisplay: false,
	  editDisplay: false,
	  hide: true,
	},
  ]);
  
  const optionsJzx = reactive({
	id: "flyos_prediction_manage",
  
	pk: "id",
	bordered: { cell: true },
	// bordered:true,
	operationColumn: true,
	operationWidth: 400,
	operationColumnWidth:300,
	showSummary: true,
	summary: [
	  {
		dataIndex: "number",
		action: "sum",
	  },
	  {
		dataIndex: "number_yu",
		action: "sum",
	  },
	  {
		dataIndex: "weight",
		action: "sum",
	  },
	  {
		dataIndex: "weight_yu",
		action: "sum",
	  },
	  {
		dataIndex: "yb_weight",
		action: "sum",
	  },
	],
	formOption: {
	  viewType: "modal",
	  width: 1000,
	  layout: [
		{
		  formType: "grid-tailwind",
		  customClass: ["mt-5"],
		  colNumber: 3,
		  bodyStyle: { paddingBottom: 0 },
		  cols: [
			{
			  formList: [{ dataIndex: "dept_id" }],
			},
			{
			  formList: [{ dataIndex: "contract_id" }],
			},
			{
			  formList: [{ dataIndex: "goods_id" }],
			},
		  ],
		},
  
		{
		  formType: "grid-tailwind",
		  customClass: [],
		  colNumber: 3,
		  bodyStyle: { paddingTop: 0 },
		  cols: [
			
			{
			  formList: [{ dataIndex: "transport_type" }],
			},
			{
			  formList: [{ dataIndex: "serve_type" }],
			},
  
			{
			  formList: [{ dataIndex: "car_no" }],
			},
			{
			  formList: [{ dataIndex: "box" }],
			},
			{
			  formList: [{ dataIndex: "box_belong" }],
			},
			{
			  formList: [{ dataIndex: "box_type_id" }],
			},
  
			{
			  formList: [{ dataIndex: "number_yu" }],
			},
			{
			  formList: [{ dataIndex: "yb_weight" }],
			},
			// {
			//   formList: [{ dataIndex: "weight_yu" }],
			// },
		  ],
		},
	  ],
	},
	api: predictionManage.getList,
	recycleApi: predictionManage.getRecycleList,
	add: {
	  show: true,
	  api: predictionManage.save,
	  text: "新增预报",
	  auth: ["prediction:manage:save"],
	},
	edit: {
	  show: false,
	  api: predictionManage.update,
	  auth: ["prediction:manage:update"],
	},
	delete: {
	  show: false,
	  api: predictionManage.deletes,
	  auth: ["prediction:manage:delete"],
	  realApi: predictionManage.realDeletes,
	  realAuth: ["prediction:manage:realDeletes"],
	},
	recovery: {
	  show: true,
	  api: predictionManage.recoverys,
	  auth: ["prediction:manage:recovery"],
	},
	import: {
	  show: false,
	  url: "prediction/manage/import",
	  templateUrl: "prediction/manage/downloadTemplate",
	  auth: ["prediction:manage:import"],
	},
	export: {
	  show: true,
	  url: "prediction/manage/export",
	  auth: ["prediction:manage:export"],
	},
	beforeRequest: (params) => {
	  params.transport_type = 1;
	},
	beforeImport: () => {
	  console.log("123");
	},
	beforeSearch:(params)=>{
	  console.log('搜索前：',params)
	  if(params.goods_ids){
		params.goods_id = params.goods_ids
	  }else{
		params.goods_id = ''
	  }
	},
	afterRequest: (params) => {
	  params.map((v, i) => {
		if (v.prediciont_status == 5 || v.prediciont_status == 6) {
		  v.disabled = false;
		} else {
		  v.disabled = true;
		}
		if(v.load_detail == null){   // 未生成装卸任务
		  v.load = 3
		}else if(v.load_detail.detail_load_status == 0){ // 已生成装卸任务
		  v.load = 2
		}else if(v.load_detail.detail_load_status == 1){ // 已生成装卸任务
		  v.load = 1
		}
		v.weight = (v.weight - 0).toFixed(3);
		v.weight_yu = (v.weight_yu - 0).toFixed(3);
		v.goods_ids = v.goods_id
	  });
	},
  });
  
  const columnsEpor = reactive([
	{
	  title: "原始凭证号",
	  dataIndex: "batch_no",
	  align: "center",
	  width: 200,
	  ellipsis: true,
	  fixed: "left",
	  tooltip: true,
	},
	{
	  title: "公司名称",
	  dataIndex: "dept_name",
	  align: "center",
	  width: 200,
	  ellipsis: true,
	  fixed: "left",
	  tooltip: true,
	},
	{
	  title: "合同号",
	  dataIndex: "contract_no",
	  align: "center",
	  width: 120,
	  ellipsis: true,
	  tooltip: true,
	},
	{
	  title: "车号",
	  dataIndex: "car_no",
	  align: "center",
	  width: 120,
	  ellipsis: true,
	  tooltip: true,
	},
	{
	  title: "品名",
	  dataIndex: "goods_name",
	  align: "center",
	  width: 200,
	  ellipsis: true,
	  tooltip: true,
	},
	
	{
	  title: "作业线路",
	  dataIndex: "work_line",
	  align: "center",
	  width: 100,
	  ellipsis: true,
	  tooltip: true,
	},
	{
	  title: "车厢位置",
	  dataIndex: "transport_number",
	  align: "center",
	  width: 100,
	  ellipsis: true,
	  tooltip: true,
	},
	{
	  title: "产地",
	  dataIndex: "producer",
	  align: "center",
	  width: 100,
	  ellipsis: true,
	  tooltip: true,
	},
	{
	  title: "箱号",
	  dataIndex: "box",
	  align: "center",
	  width: 100,
	  ellipsis: true,
	  tooltip: true,
	},
	{
	  title: "集装箱",
	  dataIndex: "is_empty",
	  align: "center",
	  width: 100,
	  ellipsis: true,
	  tooltip: true,
	  slotName:'is_empty',
	},
	{
	  title: "箱型箱类",
	  dataIndex: "box_type",
	  align: "center",
	  width: 100,
	  ellipsis: true,
	  tooltip: true,
	},
	{
		  title: "箱属",
	  dataIndex: "box_belong",
	  align: "center",
	  width: 100,
	  ellipsis: true,
	  tooltip: true,
	  },
	{
	  title: "件数",
	  dataIndex: "number",
	  align: "center",
	  width: 100,
	  ellipsis: true,
	  tooltip: true,
	  fixed: "right",
	},
	{
	  title: "预报重量",
	  dataIndex: "yb_weight",
	  align: "center",
	  width: 100,
	  ellipsis: true,
	  tooltip: true,
	  fixed: "right",
	},
	{
	  title: "备注",
	  dataIndex: "remark",
	  align: "center",
	  width: 200,
	  ellipsis: true,
	  tooltip: true,
	  fixed: "right",
	  slotName: "remark",
	},
  ]);
  </script>
  <style lang="less" scoped>
  .input {
	width: 100px;
	padding: 4px 12px;
	background: rgba(242, 243, 245);
	border: 1px solid rgba(242, 243, 245);
	border-radius: 4px;
	outline: none;
	/*清除input点击之后的黑色边框*/
  }
  
  .input:focus {
	background: #fff;
	border: 1px solid #1e80ff;
  }
  
  .yphbox {
	display: flex;
	justify-content: center;
	height: 165px;
  }
  
  .yphbox .arco-upload-wrapper {
	width: 100%;
  }
  
  .arco-upload-wrapper {
	width: 50%;
  }
  .tableCentant{
	padding-top:12px;
	border-bottom:1px solid rgba(0,0,0,.15);
	&:last-child{
	  border-bottom:none;
	}
  }
  .biaoshen{
	-ms-overflow-style: none;  /* IE 10+ */
	scrollbar-width: none;  /* Firefox */
  }
  .biaoshen::-webkit-scrollbar {
	display: none;
  }
  </style>
  <script>
  export default { name: "prediction:manage" };
  </script>
  